﻿using DotNetCore.CAP;
using Microsoft.AspNetCore.Mvc;

namespace CAP事件总线.Models
{
    public class MessageHandler: ICapSubscribe //消息的处理
    {
        static int i = 0;
        [CapSubscribe("test.message")]
        public void ReceiveMessage(string message)
        {
            i++;
            if(i<3)
            {
                throw new Exception("i 小于3，抛出异常");
            }
            Console.WriteLine("在类方法中订阅 message  is:" + message);
        }


    }
}
